<?php
/**
 * Description
 * 
 * PHP version 7
 * 
 * @category Custom
 * @package  Custom
 * @author   ryu <mo5467@126.com>
 * @date     2020-04-23 00:26:02
 * @lastTime 2020-05-01 23:53:49
 * @license  https://opensource.org/licenses/MIT MIT License
 * @link     none
 */

namespace Test\Unit;

use Design\Creational\Factory\FileLogger;
use Design\Creational\Factory\StdoutLogger;
use Design\Creational\Factory\FileLoggerFactory;
use Design\Creational\Factory\StdoutLoggerFactory;

class FactoryTest extends \Test\BaseTest
{


    public function testCanCreateFileLogger()
    {
        $logger = (new FileLoggerFactory("/home"))->createLogger();
        $this->assertInstanceOf(FileLogger::class, $logger);

        $this->expectOutputString('file logger ryu');
        $logger->log('ryu');

    }//end testCanCreateFileLogger()


    public function testCanCreateStdoutLogger()
    {
        $logger = (new StdoutLoggerFactory())->createLogger();
        $this->assertInstanceOf(StdoutLogger::class, $logger);

        $this->expectOutputString('ryu');
        $logger->log('ryu');

    }//end testCanCreateStdoutLogger()


}//end class
